package com.neusoft.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class InterceptorConfig implements WebMvcConfigurer {
	//拦截器对象的自动注入
	@Autowired
	private MyInterCeptor mi;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// TODO Auto-generated method stub
		//InterceptorRegistry是拦截器注册表，拦截器需要注册才能使用
		//addPathPatterns代表要被拦截的路径
		registry.addInterceptor(mi).addPathPatterns("/libraryController/querybooksPage/1/1");
		WebMvcConfigurer.super.addInterceptors(registry);
	}

}
